﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Npgsql;
using System.Data;

// NOTE: If you change the class name "MapService" here, you must also update the reference to "MapService" in Web.config.
public class MapService : IMapService
{
    public void DoWork()
    {
    }

    public DataSet ObtenerInformacionDeUnPunto(double x, double y)
    {
        //server=localhost;database=testing;uid=postgres;pwd=argets
        //host=localhost dbname=template_postgis user=postgres password=postgres port=5431      
        NpgsqlConnection conexion = new NpgsqlConnection("server=localhost;database=template_postgis;uid=postgres;pwd=postgres;port=5431");

        NpgsqlCommand rsCommand = conexion.CreateCommand();
        rsCommand.CommandText = "select nombre from lineas";

        NpgsqlDataAdapter rsDATAadapter = new NpgsqlDataAdapter();
        rsDATAadapter.SelectCommand = rsCommand;
        DataSet myDataSet = new DataSet();

        conexion.Open();
        rsDATAadapter.Fill(myDataSet);

        return myDataSet;
    }
}
